﻿using Minecraft.Config.Csv.CsvCom;
using Minecraft.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Minecraft.Config.Csv.CsvCls
{
	public partial class Mod_ZombieAttack
	{
		public int Id_Convert
		{
			get
			{
				return int.Parse(Id);
			}
		}
		public Point3 Start_pos_Convert
		{
			get
			{
				var strs = Start_pos.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(m => int.Parse(m)).ToList();
				return new Point3
				{
					x = strs[0],
					y = strs[1],
					z = strs[2]
				};
			}
		}

		/// <summary>
		/// 从标志点到达基地需要的时间（单位：秒)
		/// </summary>
		public int Cooling_time_Convert
		{
			get
			{
				return (int)(double.Parse(Cooling_time) * 60 * 60);
			}
		}
		/// <summary>
		/// 僵尸攻击基地持续时间（单位：秒）
		/// </summary>
		public int Attack_time_Convert
		{
			get
			{
				return (int)(double.Parse(Attack_time) * 60);
			}
		}

		/// <summary>
		/// 获取刷怪的怪物信息列表
		/// </summary>
		/// <returns></returns>
		public List<ModZombiesBrushInfo> GetModZombiesBrushInfoList()
		{
			List<ModZombiesBrushInfo> modZombiesBrushInfoList = new List<ModZombiesBrushInfo>();
			var strs = Zombies.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
			foreach (var str in strs)
			{
				var items = str.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
				ModZombiesBrushInfo modZombiesBrushInfo = new ModZombiesBrushInfo
				{
					ActorId = items[0],
					Num = int.Parse(items[1])
				};
				modZombiesBrushInfoList.Add(modZombiesBrushInfo);
			}
			return modZombiesBrushInfoList;
		}

		/// <summary>
		/// 获取尸潮的最大的持续周期（单位：秒）
		/// </summary>
		/// <param name="zombiesbrushModel"></param>
		/// <returns></returns>
		public  int GetZombiesbrushMaxCycleSecond()
		{
			return Cooling_time_Convert + Attack_time_Convert;
		}

	}
}
